#include <bits/stdc++.h>

using namespace std;
const int maxn=1001;
struct Mooncake
{
    double amount,price,priceByAmount;
} mooncakes[maxn];
bool cmp(Mooncake a,Mooncake b)
{
    return a.priceByAmount>b.priceByAmount;
}
int main_1070()
{
    int N;
    double D,profits=0.0;
    scanf("%d %lf",&N,&D);
    for (int i=0;i<N ;++i )
    {
        scanf("%lf",&mooncakes[i].amount);
    }
    for (int i=0;i<N ;++i )
    {
        scanf("%lf",&mooncakes[i].price);
        mooncakes[i].priceByAmount=mooncakes[i].price/mooncakes[i].amount;
    }
    sort(mooncakes,mooncakes+N,cmp);
    for (int i=0;i<N ;++i )
    {
        if (mooncakes[i].amount>D)
        {
            profits+=D*mooncakes[i].priceByAmount;
            break;
        }
        profits+=mooncakes[i].price;
        D-=mooncakes[i].amount;
    }
    printf("%.2lf",profits);
	return 0;
}
